# Contributor: Lindsay Zhou <i@lin.moe>
# Maintainer: Lindsay Zhou <i@lin.moe>
pkgname=fcitx5-chinese-addons
pkgver=5.1.5
pkgrel=0
pkgdesc="Chinese Addons for Fcitx"
url="https://github.com/fcitx/fcitx5-chinese-addons"
# armhf, s390x, ppc64le, riscv64: qt6-qtwebengine
arch="all !armhf !ppc64le !s390x !riscv64"
license="LGPL-2.1-or-later AND GPL-2.0-or-later"
makedepends="
	boost-dev
	cmake
	curl-dev
	extra-cmake-modules
	fcitx5-dev
	fcitx5-lua-dev
	fcitx5-qt-dev
	fmt-dev
	gettext-dev
	libime-dev
	libpinyin-dev
	opencc-dev
	qt6-qtbase-dev
	qt6-qtwebengine-dev
	samurai
	"
subpackages="$pkgname-dev $pkgname-lang"
source="$pkgname-$pkgver.tar.gz::https://github.com/fcitx/fcitx5-chinese-addons/archive/refs/tags/$pkgver.tar.gz"
options="net" # checksummed data modules

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DUSE_WEBKIT=OFF \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E testchttrans
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
e7078cbc2afa86bd728de83c1182b773269bf93d8c673a822cc96d08ab8cd5834281d44b2335f7b6262e51cbca1eeafb29471615e5f9ebca4d5375addb833069  fcitx5-chinese-addons-5.1.5.tar.gz
"
